package avicit.bdp.dms.tdm.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.properties.PlatformConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/**
 * @金航数码科技有限责任公司
 * @作者：${tableInfo.classCreator}
 * @邮箱：${tableInfo.classMailbox}
 * @创建时间： 2023-11-14 16:03
 * @类说明：bdp_asset_log
 * @修改记录：
 */
@ApiModel(value = "AssetLogDTO", description = "数据资产调用日志表")
@Table(name = "bdp_asset_log")
public class AssetLogDTO extends BaseDTO {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id
    @LogField
    @ApiModelProperty(value = "主键", name = "id")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 数据资产id
     */
    @LogField
    @ApiModelProperty(value = "数据资产id", name = "assetId")
    @FieldRemark(column = "asset_id", field = "assetId", name = "数据资产id")
    private String assetId;

    /**
     * 应用ID
     */
    @LogField
    @ApiModelProperty(value = "应用ID", name = "applicationId")
    @FieldRemark(column = "application_id", field = "applicationId", name = "应用ID")
    private String applicationId;

    /**
     * 开放服务类型[1-数据查询/2-数据推送/3-API接口/4-下载/5-模型/6-报表]
     */
    @LogField
    @ApiModelProperty(value = "开放服务类型[1-数据查询/2-数据推送/3-API接口/4-下载/5-模型/6-报表]", name = "serviceType")
    @FieldRemark(column = "service_type", field = "serviceType", name = "开放服务类型[1-数据查询/2-数据推送/3-API接口/4-下载/5-模型/6-报表]")
    private Integer serviceType;

    /**
     * 开始时间
     */
    @LogField
    @ApiModelProperty(value = "开始时间", name = "startTime")
    @FieldRemark(column = "start_time", field = "startTime", name = "开始时间")
    private Date startTime;

    /**
     * 结束时间
     */
    @LogField
    @ApiModelProperty(value = "结束时间", name = "endTime")
    @FieldRemark(column = "end_time", field = "endTime", name = "结束时间")
    private Date endTime;

    /**
     * 调用人
     */
    @LogField
    @ApiModelProperty(value = "调用人", name = "callUserId")
    @FieldRemark(column = "call_user_id", field = "callUserId", name = "调用人")
    private String callUserId;

    /**
     * 调用人名字
     */
    @LogField
    @ApiModelProperty(value = "调用人名字", name = "callUserName")
    @FieldRemark(column = "call_user_name", field = "callUserName", name = "调用人名字")
    private String callUserName;

    /**
     * 调用状态,0-失败，1-成功
     */
    @LogField
    @ApiModelProperty(value = "调用状态,0-失败，1-成功", name = "callStatus")
    @FieldRemark(column = "call_status", field = "callStatus", name = "调用状态,0-失败，1-成功")
    private Integer callStatus;

    /**
     * 调用结果
     */
    @ApiModelProperty(value = "调用结果", name = "callResult")
    @FieldRemark(column = "call_result", field = "callResult", name = "调用结果")
    private String callResult;

    /**
     * 调用ip
     */
    @ApiModelProperty(value = "调用ip", name = "callIp")
    @FieldRemark(column = "call_ip", field = "callIp", name = "调用ip")
    private String callIp;

    @Transient
    private String serviceTypeName;
    @Transient
    private String applyUnit;

    public String getApplyUnit() {
        return applyUnit;
    }

    public void setApplyUnit(String applyUnit) {
        this.applyUnit = applyUnit;
    }

    public String getServiceTypeName() {
        return serviceTypeName;
    }

    public void setServiceTypeName(String serviceTypeName) {
        this.serviceTypeName = serviceTypeName;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getAssetId() {
        return assetId;
    }

    public void setAssetId(String assetId) {
        this.assetId = assetId;
    }

    public String getApplicationId() {
        return applicationId;
    }

    public void setApplicationId(String applicationId) {
        this.applicationId = applicationId;
    }


    public java.util.Date getStartTime() {
        return startTime;
    }

    public void setStartTime(java.util.Date startTime) {
        this.startTime = startTime;
    }

    public java.util.Date getEndTime() {
        return endTime;
    }

    public void setEndTime(java.util.Date endTime) {
        this.endTime = endTime;
    }

    public String getCallUserId() {
        return callUserId;
    }

    public void setCallUserId(String callUserId) {
        this.callUserId = callUserId;
    }

    public String getCallUserName() {
        return callUserName;
    }

    public void setCallUserName(String callUserName) {
        this.callUserName = callUserName;
    }

    public String getCallResult() {
        return callResult;
    }

    public void setCallResult(String callResult) {
        this.callResult = callResult;
    }

    public String getCallIp() {
        return callIp;
    }

    public void setCallIp(String callIp) {
        this.callIp = callIp;
    }

    public Integer getServiceType() {
        return serviceType;
    }

    public void setServiceType(Integer serviceType) {
        this.serviceType = serviceType;
    }

    public Integer getCallStatus() {
        return callStatus;
    }

    public void setCallStatus(Integer callStatus) {
        this.callStatus = callStatus;
    }

    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "bdp_asset_log";
        } else {
            return super.logFormName;
        }
    }

    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "bdp_asset_log";
        } else {
            return super.logTitle;
        }
    }

    public PlatformConstant.LogType getLogType() {
        if (super.logType == null) {
            return PlatformConstant.LogType.module_operate;
        } else {
            return super.logType;
        }
    }

}